<<<<<<< HEAD
<?php

namespace app\index\controller;

use think\Controller;
use think\Cookie;

class Auth extends Controller
{
    protected $uid;

    protected $suffix;

    public function _initialize()
    {
        if (!session('Auth.Uid')) {
            if (cookie('Uid')) {
                $this->saveSession(cookie('Uid'), 1);
            } else {
                $this->redirect('/login');
            }
        } else {
            $this->saveSession(session('Auth.Uid'));
        }
    }

    protected function saveSession($id, $type = 0)
    {
        if ($type) {
            session('Auth.Uid', $id);
        }
        $this->uid = (int)$id;
        $this->suffix = substr($this->uid, -1, 1);
    }
}
=======
<?php

namespace app\index\controller;

use think\Controller;
use think\Cookie;

class Auth extends Controller
{
    protected $uid;

    protected $suffix;

    public function _initialize()
    {
        if (!session('Auth.Uid')) {
            if (cookie('Uid')) {
                $this->saveSession(cookie('Uid'), 1);
            } else {
                $this->redirect('/login');
            }
        } else {
            $this->saveSession(session('Auth.Uid'));
        }
    }

    protected function saveSession($id, $type = 0)
    {
        if ($type) {
            session('Auth.Uid', $id);
        }
        $this->uid = (int)$id;
        $this->suffix = substr($this->uid, -1, 1);
    }
}
>>>>>>> 93c40d8086b7a8d5a9aa3548fdc8eb06a4272cf7
